-
Notifications
You must be signed in to change notification settings - Fork 34
mldsa_native.h: Add PCT-aware MLD_TOTAL_ALLOC constants #869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ac68e65 to
0ca77bd
Compare
2eaa5b6 to
f880e8d
Compare
mkannwischer
added a commit
to pq-code-package/mlkem-native
that referenced
this pull request
Jan 11, 2026
Multilevel builds require MLK_CONFIG_NO_SUPERCOP since the SUPERCOP naming convention (crypto_kem_xxx) does not disambiguate between parameter sets. Add MLK_CONFIG_NO_SUPERCOP to all multilevel build configs and propagate it to the API layer in the legacy config path. This also fixes problem with mlkem_native.h: On multiple inclusions of mlkem_native.h without NO_SUPERCOP set, mlkem_native.h would not undef the API_CONFIG macros in the end of the file causing the second inclusion of mlkem_native.h to set the LEGACY_CONFIG option. - Ported from pq-code-package/mldsa-native#869 Signed-off-by: Matthias J. Kannwischer <[email protected]>
mkannwischer
added a commit
to pq-code-package/mlkem-native
that referenced
this pull request
Jan 11, 2026
Split KEYPAIR allocation constants into _NO_PCT and _PCT variants to accurately reflect memory usage with and without pairwise consistency testing (PCT). MLK_TOTAL_ALLOC_*_KEYPAIR now automatically selects the appropriate value based on MLK_CONFIG_KEYGEN_PCT. For legacy configs, assume PCT is enabled (conservative). The default alloc test config no longer enables PCT; PCT is tested via config-variations. - Ported from pq-code-package/mldsa-native#869 Signed-off-by: Matthias J. Kannwischer <[email protected]>
f880e8d to
9e2cd19
Compare
mkannwischer
added a commit
to pq-code-package/mlkem-native
that referenced
this pull request
Jan 12, 2026
Multilevel builds require MLK_CONFIG_NO_SUPERCOP since the SUPERCOP naming convention (crypto_kem_xxx) does not disambiguate between parameter sets. Add MLK_CONFIG_NO_SUPERCOP to all multilevel build configs and propagate it to the API layer in the legacy config path. This also fixes problem with mlkem_native.h: On multiple inclusions of mlkem_native.h without NO_SUPERCOP set, mlkem_native.h would not undef the API_CONFIG macros in the end of the file causing the second inclusion of mlkem_native.h to set the LEGACY_CONFIG option. - Ported from pq-code-package/mldsa-native#869 Signed-off-by: Matthias J. Kannwischer <[email protected]>
mkannwischer
added a commit
to pq-code-package/mlkem-native
that referenced
this pull request
Jan 12, 2026
Split KEYPAIR allocation constants into _NO_PCT and _PCT variants to accurately reflect memory usage with and without pairwise consistency testing (PCT). MLK_TOTAL_ALLOC_*_KEYPAIR now automatically selects the appropriate value based on MLK_CONFIG_KEYGEN_PCT. For legacy configs, assume PCT is enabled (conservative). The default alloc test config no longer enables PCT; PCT is tested via config-variations. - Ported from pq-code-package/mldsa-native#869 Signed-off-by: Matthias J. Kannwischer <[email protected]>
e346f89 to
85c42a0
Compare
mkannwischer
added a commit
to pq-code-package/mlkem-native
that referenced
this pull request
Jan 12, 2026
Multilevel builds require MLK_CONFIG_NO_SUPERCOP since the SUPERCOP naming convention (crypto_kem_xxx) does not disambiguate between parameter sets. Add MLK_CONFIG_NO_SUPERCOP to all multilevel build configs and propagate it to the API layer in the legacy config path. This also fixes problem with mlkem_native.h: On multiple inclusions of mlkem_native.h without NO_SUPERCOP set, mlkem_native.h would not undef the API_CONFIG macros in the end of the file causing the second inclusion of mlkem_native.h to set the LEGACY_CONFIG option. - Ported from pq-code-package/mldsa-native#869 Signed-off-by: Matthias J. Kannwischer <[email protected]>
mkannwischer
added a commit
to pq-code-package/mlkem-native
that referenced
this pull request
Jan 12, 2026
Split KEYPAIR allocation constants into _NO_PCT and _PCT variants to accurately reflect memory usage with and without pairwise consistency testing (PCT). MLK_TOTAL_ALLOC_*_KEYPAIR now automatically selects the appropriate value based on MLK_CONFIG_KEYGEN_PCT. For legacy configs, assume PCT is enabled (conservative). The default alloc test config no longer enables PCT; PCT is tested via config-variations. - Ported from pq-code-package/mldsa-native#869 Signed-off-by: Matthias J. Kannwischer <[email protected]>
mkannwischer
added a commit
to pq-code-package/mlkem-native
that referenced
this pull request
Jan 12, 2026
Multilevel builds require MLK_CONFIG_NO_SUPERCOP since the SUPERCOP naming convention (crypto_kem_xxx) does not disambiguate between parameter sets. Add MLK_CONFIG_NO_SUPERCOP to all multilevel build configs and propagate it to the API layer in the legacy config path. This also fixes problem with mlkem_native.h: On multiple inclusions of mlkem_native.h without NO_SUPERCOP set, mlkem_native.h would not undef the API_CONFIG macros in the end of the file causing the second inclusion of mlkem_native.h to set the LEGACY_CONFIG option. - Ported from pq-code-package/mldsa-native#869 Signed-off-by: Matthias J. Kannwischer <[email protected]>
mkannwischer
added a commit
to pq-code-package/mlkem-native
that referenced
this pull request
Jan 12, 2026
Split KEYPAIR allocation constants into _NO_PCT and _PCT variants to accurately reflect memory usage with and without pairwise consistency testing (PCT). MLK_TOTAL_ALLOC_*_KEYPAIR now automatically selects the appropriate value based on MLK_CONFIG_KEYGEN_PCT. For legacy configs, assume PCT is enabled (conservative). The default alloc test config no longer enables PCT; PCT is tested via config-variations. - Ported from pq-code-package/mldsa-native#869 Signed-off-by: Matthias J. Kannwischer <[email protected]>
hanno-becker
approved these changes
Jan 12, 2026
Contributor
hanno-becker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Multilevel builds require MLD_CONFIG_NO_SUPERCOP since the SUPERCOP naming convention (crypto_sign_xxx) does not disambiguate between parameter sets. Add MLD_CONFIG_NO_SUPERCOP to all multilevel build configs and propagate it to the API layer in the legacy config path. This also fixes problem with mldsa_native.h: On multiple inclusions of mldsa_native.h without NO_SUPERCOP set, mldsa_native.h would not undef the API_CONFIG macros in the end of the file causing the second inclusion of mldsa_native.h to set the LEGACY_CONFIG option. Signed-off-by: Matthias J. Kannwischer <[email protected]>
Split KEYPAIR allocation constants into _NO_PCT and _PCT variants to accurately reflect memory usage with and without pairwise consistency testing (PCT). MLD_TOTAL_ALLOC_*_KEYPAIR now automatically selects the appropriate value based on MLD_CONFIG_KEYGEN_PCT. For legacy configs, assume PCT is enabled (conservative). Also correct REDUCE_RAM KEYPAIR values which were previously using PCT values unconditionally. The default alloc test config no longer enables PCT; PCT is tested via config-variations. Signed-off-by: Matthias J. Kannwischer <[email protected]>
Add config-variations tests for REDUCE_RAM and REDUCE_RAM + PCT configurations to ensure allocation constants are validated for all four configuration variants. Signed-off-by: Matthias J. Kannwischer <[email protected]>
Remove MLD_MAX_TOTAL_ALLOC and MLD_MAX_TOTAL_ALLOC_{KEYPAIR,SIGN,VERIFY}
constants. These exposed the maximum allocation across all security
levels even in single-level builds, which was confusing. Users should
instead use the explicitly security-level-labeled constants such as
MLD_TOTAL_ALLOC_87_KEYPAIR.
The per-level MLD_TOTAL_ALLOC_{44,65,87}_{KEYPAIR,SIGN,VERIFY} and
aggregate MLD_TOTAL_ALLOC_{44,65,87} constants remain available.
Signed-off-by: Matthias J. Kannwischer <[email protected]>
85c42a0 to
18d5fa5
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Split KEYPAIR allocation constants into _NO_PCT and PCT variants to
accurately reflect memory usage with and without pairwise consistency
testing (PCT). MLD_TOTAL_ALLOC*_KEYPAIR now automatically selects
the appropriate value based on MLD_CONFIG_KEYGEN_PCT.
For legacy configs, assume PCT is enabled (conservative).
Also correct REDUCE_RAM KEYPAIR values which were previously using
PCT values unconditionally.
The default alloc test config no longer enables PCT; PCT is tested
via config-variations.